<?php
// 节点监督
namespace app\home\controller;
use think\Db;
class Nodeinfo extends HomeBase {

	public function getlist() {
		$order = input('order');	// 排序
		$page = input('page','1','intval');		// 当前页
		$row = input('row','10','intval');		// 每页显示数据

		// 排序
		if (empty($order)) $order = 'create_time desc';
		
		// 分页
		$start = ($page-1) * $row;

		$list = array();
		$total = Db::name('Nodeinfo')->count('id');
		$list = Db::name('Nodeinfo')->order($order)->limit($start,$row)->field('id,keshi,jztime,status')->select();
		if (empty($list)) 
			return json(array('status'=>0,'msg'=>'暂无数据'));
		else {
			return json(array('status'=>1,'info'=>$list,'count'=>$total));
		}
	}

	public function getdetail() {
		$nid = input('nid');
		$nid = intval($nid);
		$info = Db::name('Nodeinfo')->where('id',$nid)->find();
		if (!$info)
			return json(array('status'=>0,'msg'=>'数据未找到'));
		return json(array('status'=>1,'info'=>$info));
	}
}